package com.sxt.sys.mapper;

import com.sxt.sys.domain.Role;

import java.io.Serializable;
import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 老雷
 * @since 2019-08-12
 */
public interface RoleMapper extends BaseMapper<Role> {

	@Delete("delete from sys_role_permission where rid=#{value}")
	void deleteRolePermissionByRid(Serializable id);

	@Select("select pid from sys_role_permission where rid=#{value}")
	List<Integer> queryRolePermissionIsByRId(Integer id);

	@Insert("insert into sys_role_permission(rid,pid) value(#{rid},#{pid})")
	void insertRolePermission(@Param("rid")Integer id, @Param("pid")Integer pid);

	@Select("select rid from sys_role_user where uid = #{value}")
	List<Integer> queryRoleUserByUserId(Integer id);


	List<String> queryRoleNameByIds(List<Integer> roleIds);
}
